home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sources.misc
- From: tony@ajfcal.UUCP (Tony Field)
- subject: v12i110: fm patch01
- Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
-
- Posting-number: Volume 12, Issue 110
- Submitted-by: tony@ajfcal.UUCP (Tony Field)
- Archive-name: fm/patch01
-
- Hello Brandon,
-
- Please accept this patch to "fm".
- -----------------------------------------------
-
- This patch to fm fixes cursor activity while editing a hex nibble, and
- corrects a problem that mis-formats the last 16 bytes of a file while
- saving to a print file.
-
- tony..
- -----------------------------------------------------------------------
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of shell archive."
- # Contents: patch01
- # Wrapped by tony@ajfcal on Wed May 16 19:49:28 1990
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'patch01' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'patch01'\"
- else
- echo shar: Extracting \"'patch01'\" \(6789 characters\)
- sed "s/^X//" >'patch01' <<'END_OF_FILE'
- XPrereq: 0
- X*** old/patchlevel.h
- X--- patchlevel.h
- X**************
- X*** 1
- X! #define PATCHLEVEL 0
- X--- 1 -----
- X! #define PATCHLEVEL 1
- X*** old/fm.c
- X--- fm.c
- X**************
- X*** 14,20
- X
- X Permission is given to distribute the source and documentation files
- X and/or compiled binaries associated with fm as long as no monies are
- X! exchanged for their use or distribution.
- X
- X No responsibility is taken for any errors on inaccuracies inherent
- X either to the comments or the code of this program, but, if reported
- X--- 14,20 -----
- X
- X Permission is given to distribute the source and documentation files
- X and/or compiled binaries associated with fm as long as no monies are
- X! exchanged for their use.
- X
- X No responsibility is taken for any errors on inaccuracies inherent
- X either to the comments or the code of this program, but, if reported
- X**************
- X*** 22,28
- X
- X Author: Tony Field
- X tony@ajfcal
- X- */
- X
- X #include <stdio.h>
- X #include <sys/types.h>
- X--- 22,27 -----
- X
- X Author: Tony Field
- X tony@ajfcal
- X
- X Patchlevels
- X ===========
- X**************
- X*** 24,29
- X tony@ajfcal
- X */
- X
- X #include <stdio.h>
- X #include <sys/types.h>
- X #include <sys/stat.h>
- X--- 23,36 -----
- X Author: Tony Field
- X tony@ajfcal
- X
- X+ Patchlevels
- X+ ===========
- X+ Patchlevel 1: May-1990
- X+ 1. clean up cursor motion while editing hex side of screen.
- X+ 2. KEY_UNDO removed for M_TERMCAP compilation
- X+ 3. fixed file print on last 16 bytes of file
- X+ */
- X+
- X #include <stdio.h>
- X #include <sys/types.h>
- X #include <sys/stat.h>
- X**************
- X*** 89,95
- X || (statbuf.st_mode & S_IFMT) == S_IFREG)
- X max_fpos = (long) statbuf.st_size;
- X else
- X! max_fpos = 1999999999; /* infinity??? */
- X
- X if ((fp = open (fname, O_RDWR)) == -1)
- X { if ((fp = open (fname, O_RDONLY)) == -1)
- X--- 96,102 -----
- X || (statbuf.st_mode & S_IFMT) == S_IFREG)
- X max_fpos = (long) statbuf.st_size;
- X else
- X! max_fpos = 0x7fffffffL; /* infinity??? */
- X
- X if ((fp = open (fname, O_RDWR)) == -1)
- X { if ((fp = open (fname, O_RDONLY)) == -1)
- X**************
- X*** 369,374
- X fputc (hbuf[1], pfile);
- X fputc (' ', pfile);
- X }
- X /* display ascii side */
- X
- X fprintf (pfile, " ");
- X--- 376,385 -----
- X fputc (hbuf[1], pfile);
- X fputc (' ', pfile);
- X }
- X+
- X+ for ( ; m % 16; m++)
- X+ fprintf (pfile, " ");
- X+
- X /* display ascii side */
- X
- X fprintf (pfile, " ");
- X**************
- X*** 402,407
- X int x, y; /* screen coords. */
- X int hexa, hexb, cbyte;
- X int reflected; /* was a change really done */
- X
- X if (byte_pos >= nbytes)
- X byte_pos = nbytes - 1;
- X--- 413,419 -----
- X int x, y; /* screen coords. */
- X int hexa, hexb, cbyte;
- X int reflected; /* was a change really done */
- X+ int have_key;
- X
- X if (byte_pos >= nbytes)
- X byte_pos = nbytes - 1;
- X**************
- X*** 407,413
- X byte_pos = nbytes - 1;
- X if (byte_pos < 0)
- X byte_pos = 0;
- X!
- X while (1)
- X {
- X mvwprintw (stdscr, 1, 6, "%lx ", fpos + byte_pos);
- X--- 419,426 -----
- X byte_pos = nbytes - 1;
- X if (byte_pos < 0)
- X byte_pos = 0;
- X!
- X! have_key = 0;
- X while (1)
- X {
- X mvwprintw (stdscr, 1, 6, "%lx ", fpos + byte_pos);
- X**************
- X*** 416,422
- X wmove (stdscr, y, x);
- X wrefresh (stdscr);
- X #endif
- X! key = mvwgetch (stdscr, y, x);
- X
- X switch (key) /* any user keys or function keys */
- X {
- X--- 429,436 -----
- X wmove (stdscr, y, x);
- X wrefresh (stdscr);
- X #endif
- X! if (have_key == 0)
- X! key = mvwgetch (stdscr, y, x);
- X
- X have_key = 0;
- X switch (key) /* any user keys or function keys */
- X**************
- X*** 418,423
- X #endif
- X key = mvwgetch (stdscr, y, x);
- X
- X switch (key) /* any user keys or function keys */
- X {
- X case FWD:
- X--- 432,438 -----
- X if (have_key == 0)
- X key = mvwgetch (stdscr, y, x);
- X
- X+ have_key = 0;
- X switch (key) /* any user keys or function keys */
- X {
- X case FWD:
- X**************
- X*** 479,484
- X
- X case UND:
- X case KEY_F(5):
- X case KEY_UNDO:
- X return (UND);
- X break;
- X--- 494,500 -----
- X
- X case UND:
- X case KEY_F(5):
- X+ #ifndef M_TERMCAP
- X case KEY_UNDO:
- X #endif
- X return (UND);
- X**************
- X*** 480,485
- X case UND:
- X case KEY_F(5):
- X case KEY_UNDO:
- X return (UND);
- X break;
- X
- X--- 496,502 -----
- X case KEY_F(5):
- X #ifndef M_TERMCAP
- X case KEY_UNDO:
- X+ #endif
- X return (UND);
- X break;
- X
- X**************
- X*** 520,528
- X { if (isvalid (key))
- X { wattrset (stdscr, A_STANDOUT);
- X waddch (stdscr, key);
- X- #ifdef M_TERMCAP
- X- wrefresh (stdscr);
- X- #endif
- X maybe_dirty = 1;
- X wbuf[byte_pos] = key;
- X reflect_change (byte_pos, HEX, wbuf);
- X--- 537,542 -----
- X { if (isvalid (key))
- X { wattrset (stdscr, A_STANDOUT);
- X waddch (stdscr, key);
- X maybe_dirty = 1;
- X wbuf[byte_pos] = key;
- X reflect_change (byte_pos, HEX, wbuf);
- X**************
- X*** 542,550
- X key = wgetch (stdscr); /* 2nd nibble */
- X if (isxdigit (key))
- X { waddch (stdscr, key);
- X- #ifdef M_TERMCAP
- X- wrefresh (stdscr);
- X- #endif
- X hexb = key;
- X }
- X reflected = 1;
- X--- 556,561 -----
- X key = wgetch (stdscr); /* 2nd nibble */
- X if (isxdigit (key))
- X { waddch (stdscr, key);
- X hexb = key;
- X }
- X reflected = 1;
- X**************
- X*** 560,567
- X if (hexa || hexb)
- X reflect_change (byte_pos, ASC, wbuf);
- X }
- X! if (byte_pos < BSIZE - 1 && (reflected || key == ' '))
- X! { byte_pos++;
- X }
- X wattrset (stdscr, 0);
- X if (key == UND || key == KEY_F(5))
- X--- 571,584 -----
- X if (hexa || hexb)
- X reflect_change (byte_pos, ASC, wbuf);
- X }
- X! if ((key < 0 || key > 256) && key != KEY_LEFT) /* function key ?? */
- X! have_key = 1;
- X! else
- X! {
- X! if (byte_pos < BSIZE - 1 && (reflected || key == ' ')
- X! && key != KEY_LEFT)
- X! { byte_pos++;
- X! }
- X }
- X wattrset (stdscr, 0);
- X #ifdef M_TERMCAP
- X**************
- X*** 564,569
- X { byte_pos++;
- X }
- X wattrset (stdscr, 0);
- X if (key == UND || key == KEY_F(5))
- X return (UND);
- X break;
- X--- 581,587 -----
- X }
- X }
- X wattrset (stdscr, 0);
- X+ #ifdef M_TERMCAP
- X if (key == UND || key == KEY_F(5))
- X #else
- X if (key == UND || key == KEY_F(5) || key == KEY_UNDO)
- X**************
- X*** 565,570
- X }
- X wattrset (stdscr, 0);
- X if (key == UND || key == KEY_F(5))
- X return (UND);
- X break;
- X }
- X--- 583,591 -----
- X wattrset (stdscr, 0);
- X #ifdef M_TERMCAP
- X if (key == UND || key == KEY_F(5))
- X+ #else
- X+ if (key == UND || key == KEY_F(5) || key == KEY_UNDO)
- X+ #endif
- X return (UND);
- X break;
- X }
- END_OF_FILE
- if test 6789 -ne `wc -c <'patch01'`; then
- echo shar: \"'patch01'\" unpacked with wrong size!
- fi
- # end of 'patch01'
- fi
- echo shar: End of shell archive.
- exit 0
-
-
-